import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

import org.korifey.ffalg.FFBitSet;
import org.korifey.ffalg.NumberTheory;
import org.korifey.ffalg.Probabilities;


public class Problem23 {
	
	public static void main(String[] args) {
		System.out.println(solve());
	}
	static int n = 20162;	
	//static int n = 28123;
	private static int[] propDivSum = new int[n];
	
	public static int propDivSum(int x) {
		if (x >= propDivSum.length || propDivSum[x] == 0) {
			int res = 0;
			for (long i=1; i<=x/2; i++) {
				if (x %i ==0) res+=i;
			}
			if (x < propDivSum.length) propDivSum[x] = res;
			else return res;
		}
		return propDivSum[x];
	}
		
	public static long solve() {		
		List<Integer> abundant = new ArrayList<Integer>();
		for (int i=1; i<n; i++) {
			if (propDivSum(i) > i) {
				abundant.add(i); 
			}
		}
		
		
		int[] arr = new int[abundant.size()];
		for (int i=0; i<arr.length; i++) {
			arr[i] = abundant.get(i);
		}
		System.out.println(arr.length);
		
		FFBitSet set = new FFBitSet(n);
		int x;
		for (int i=0; i<arr.length; i++)
			for (int j=i; j<arr.length && (x = (arr[i] + arr[j])) < n; j++) {				
				set.set(x);
			}
		
		long res = 0;
		for (int i=1; i<n; i++) {
			if (!set.get(i)) {
				res += i;
			}
		}
		
		return res;
	}
	
}
